<template>
  <el-card>
    <div slot="header">
      <span>满意度趋势</span>
    </div>
     <ve-line :data="chartData" :settings="chartSettings"></ve-line>
  </el-card>
</template>
<script>
  import { getRateTrend } from "@/api/stat";
  export default {
    data() {
      this.chartSettings = {
        labelMap: {
          day: '日期',
          rate: '满意度'
        },
        yAxisType: ['percent']
      }
      return {
        chartData: {
          columns: ['day', 'rate'],
          rows: []
        }
      }
    },
    created() {
      this.initData({
          shopId: 10
        })
    },
    methods: {
      initData(data) {
        getRateTrend(data).then(res => {
          res.data.data.map(row => {
            row.rate = row.feedback / row.sum || 0
            return row
          })
          this.chartData.rows = res.data.data
          console.log(this.chartData.rows);
          
        })
      }
    }
  }
</script>
